#ifndef DRAWER_H
#define DRAWER_H

#include <QWidget>
#include<QToolButton>
#include<QTreeWidget>
#include<QListWidget>
#include"widget.h"

class Drawer : public QWidget
{
    Q_OBJECT
public:
    Drawer(QString account,QString password,QWidget *parent=nullptr,Qt::WindowFlags f=Qt::Widget);

    // QObject interface
public:
    bool eventFilter(QObject *watched, QEvent *event) override;

private slots:
    void showChatWidget(QTreeWidgetItem *,int);
    void updateAndSaveName(const QString& before_modify_usrName,const QString& after_modify_usrName);

signals:
    void emitUserName(QString before_modify_usrName,QString after_modify_usrName);

private:
    QWidget *init_head_portrait_Widget();
    QWidget *init_selectionbar();
    QListWidget *init_Seesion_widget(const QStringList& seesion_name=QStringList{});
    QTreeWidget *init_friend_list();

    const QStringList get_current_session();
    const QStringList get_friends_name();

private:

//    QToolButton *toolBtn1;
//    QToolButton *toolBtn2;
//    QToolButton *toolBtn3;
//    QToolButton *toolBtn4;
//    QToolButton *toolBtn5;
//    QToolButton *toolBtn6;
//    QToolButton *toolBtn7;
//    QToolButton *toolBtn8;
//    QToolButton *toolBtn9;

    QString m_account;    //账号
    QString m_password;   //密码

    QTreeWidget *friend_list;   //所有好友

    QListWidget *seesion_list;    //所有消息

    Ui::widget *chatWidget;

};

#endif // DRAWER_H
